#!/bin/bash
# Script to stop all running Flask servers

echo "Stopping all Flask servers..."

# Kill all python app processes
pkill -f "python app.py"
pkill -f "python app_new.py"

echo "All Flask servers have been stopped."

# Check if any are still running
remaining=$(ps aux | grep -E "python app" | grep -v grep | wc -l)
if [ $remaining -eq 0 ]; then
    echo "✅ Successfully stopped all processes."
else
    echo "⚠️  Some processes may still be running. Use 'ps aux | grep python' to check."
fi